from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.edge.service import Service as EdgeService
from selenium.webdriver.edge.options import Options as EdgeOptions
import time

# 创建 Edge 选项
edge_options = EdgeOptions()
# edge_options.add_argument('--headless')  # 可选：无头模式

# 手动指定 msedgedriver 路径（❗非常重要）
service = EdgeService(executable_path=r'C:\Users\admin\Downloads\edgedriver_win64\msedgedriver.exe')

# 启动 Edge 浏览器
driver = webdriver.Edge(service=service, options=edge_options)
driver.maximize_window()
# 打开网页
url = "https://vsoc.bjev.com.cn/user/login"
# url = "https://vsoc.bjev.com.cn/dsoc/classification/overview/all"
# url = "https://vsoc.bjev.com.cn/vsoc/overview/general"
print(f"正在打开: {url}")
driver.get(url)

# 等待几秒查看页面是否加载成功
time.sleep(6)

# 输出当前页面标题
print("当前页面标题:", driver.title)
''''''
'''--------------------登录-----------------------------------------'''
# driver.find_element(By.CSS_SELECTOR, "#username").send_keys("yangbiao")
# driver.find_element(By.CSS_SELECTOR, "#password").send_keys("3738g2$@4Pq")
# driver.find_element(By.CSS_SELECTOR, "#root > div > div.login___vRELY > div.form___qrIjX > div > form > button").click()
time.sleep(1)
driver.find_element(By.CSS_SELECTOR,"#root > div > div > section > aside > div > div.ant-pro-sider-collapsed-button.ant-pro-sider-collapsed-button-collapsed").click()
driver.find_element(By.CSS_SELECTOR, "#rc-menu-uuid-76577-2-\/vsoc-popup").click()
driver.find_element(By.CSS_SELECTOR,"#rc-menu-uuid-76577-2-\/vsoc-popup > li.ant-menu-submenu.ant-menu-submenu-inline.ant-pro-base-menu-submenu.ant-menu-submenu-open").click()
time.sleep(1)








#关闭浏览器
driver.quit()